package com.green.common.fusionchart;

import java.util.ArrayList;
import java.util.List;

import com.green.common.fusionchart.enums.DefaultColorEnum;

public class Pie3D extends Pie {

	private List<Set> sets;

	public List<Set> getSets() {
		return sets;
	}

	public void setSets(List<Set> sets) {
		this.sets = sets;
		setColorForSet(sets, null);
	}

	public void setSets(List<Set> sets, List<DefaultColorEnum> colors) {
		this.sets = sets;
		setColorForSet(sets, colors);
	}

	// 这个以后拓展用
	public void setSetsForStringColor(List<Set> sets, List<String> colors) {

	}

	public void setColorForSet(List<Set> sets, List<DefaultColorEnum> colors) {
		if (colors == null || colors.size() == 0) {
			colors = new ArrayList<DefaultColorEnum>();
			for (DefaultColorEnum color : DefaultColorEnum.values()) {
				colors.add(color);
			}
		}
		int i = 0;
		for (Set set : sets) {
			set.setColor(colors.get(i).getColor());
			i++;
			if (i == colors.size())
				i = 0;
		}
	}
}
